package com.tz.web.book;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.tz.bean.Book;
import com.tz.bean.Star;
import com.tz.bean.TzParams;
import com.tz.core.BaseController;
import com.tz.service.book.IBookService;
import com.tz.service.course.ICourseService;
import com.tz.service.user.IStarService;

@RequestMapping("/stage")
@Controller
public class SIndexController extends BaseController{
	
	@Autowired
	private IStarService starService;
	
	@Autowired
	private IBookService bookService;
	
	@Autowired
	private ICourseService courseService;

	@RequestMapping("/index")
	public String stageIndex(TzParams params){
		params.setIsDelete(1);
		List<Star> stars = starService.find(params);
		session.setAttribute("stars", stars);
		return "redirect:index.jsp";
	}
	
	@RequestMapping("/java")
	public String stageJava(){
		return "redirect:java.jsp";
	}
	
	@RequestMapping("/vip")
	public String stageVip(){
		return "redirect:vip.jsp";
	}
	
	@RequestMapping("/enroll")
	public String stageEnroll(){
		return "redirect:enroll.jsp";
	}
	
	@RequestMapping("/regest")
	public String toRegist(){
		return "redirect:regest.jsp";
	}
	
	@RequestMapping("/book")
	public String listBookLogs(TzParams params){
		List<Book> books = bookService.listBooks(params);
		session.setAttribute("books", books);
		return "redirect:book.jsp";
	}
	
	@RequestMapping("/course")
	public String course(TzParams params){
	/*	params.setIsDelete(1);
		params.setStatus(1);
		List<Course> courses = courseService.listCourses(params);
		session.setAttribute("courses", courses);*/
		return "redirect:course.jsp";
	}
}
